﻿using System.Collections.Generic;
using System.Web.Mvc;

namespace ScoutNET.Helpers
{
    public static class FileUploadHelper
    {
        public static MvcHtmlString FileUpload(this HtmlHelper htmlHelper, string name)
        {
            return FileUpload(htmlHelper, name, ((IDictionary<string, object>) null));
        }

        public static MvcHtmlString FileUpload(this HtmlHelper htmlHelper, string name, IDictionary<string, object> htmlAttributes)
        {
            TagBuilder builder = new TagBuilder("input");
            builder.MergeAttributes<string, object>(htmlAttributes);
            builder.MergeAttribute("type", "file");
            builder.MergeAttribute("name", name);
            builder.MergeAttribute("id", name);

            return MvcHtmlString.Create(builder.ToString(TagRenderMode.Normal));
        }
    }
}
